#include <iostream>
#include <cstdio>
#define mxn 5000+10
using namespace std;
int n,m,p;
int f[mxn];
int fd(int x)
{
    if (f[x]==x) return x;
    f[x]=fd(f[x]);
    return f[x];
}
int mrg(int x,int y)
{
    int rx=fd(x),ry=fd(y);
    f[rx]=f[ry];
}
int main()
{
    scanf("%d%d%d",&n,&m,&p);
    for (int i=1;i<=n;++i) f[i]=i;
    int x,y;
    for (int i=1;i<=m;++i)
    {
        scanf("%d%d",&x,&y);
        mrg(x,y);        
    }
    for (int i=1;i<=p;++i)
    {
        scanf("%d%d",&x,&y);
        if (fd(x)==fd(y)) printf("Yes\n");
        else printf("No\n");
    }
    return 0;
}

